package com.etilize.importer;

public class TimeStatGenerator {
    
    protected static enum TYPE {
        DB_INTERACTION, FILE_OPERATION, FTP_INTERACTION, DB_CRITICAL
    };

    
    private long totalElapsedTime;
    private long lastRunTime;
    private long startTime;
    private static long cummulativeTime = 0;

    public TimeStatGenerator() {
        this.lastRunTime = 0;
        this.totalElapsedTime = 0;
    }

    public void startTimer(){
        this.lastRunTime = 0;
        this.startTime = System.nanoTime();
    }

    public float stopTimer() {
        lastRunTime = System.nanoTime() - startTime;
        totalElapsedTime+=lastRunTime;
        cummulativeTime+=lastRunTime;
        return ((float)lastRunTime)/1000/1000/1000;
    }

    public float getTotalElapsedTime() {
        return ((float)totalElapsedTime)/1000/1000/1000;
    }

    public static float getCummulativeTime(){
        return ((float)cummulativeTime)/1000/1000/1000;
    }
}
